]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix problems when leaving the overview with a zoomed window
authorFlorian Müllner <fmuellner@src.gnome.org>
Sun, 7 Feb 2010 14:25:16 +0000 (15:25 +0100)
committerFlorian Müllner <fmuellner@src.gnome.org>
Mon, 22 Feb 2010 22:41:09 +0000 (23:41 +0100)
While zooming, a window clone is reparented to the stage and thus cannot
be destroyed automatically by the "parent" container. To prevent the clone
and the corresponding overlay from leaking, we enforce destroying the clone
with the workspace.

https://bugzilla.gnome.org/show_bug.cgi?id=609243

js/ui/workspace.js

index a9f2aeca1c599c67a30fc3bc2b265b9daea5dd8b..cf75f05efd4124e52b91a8b3ed10bb5546539dcf 100644 (file)
@@ -117,6 +117,7 @@ WindowClone.prototype = {
         this.actor.connect('scroll-event',
                            Lang.bind(this, this._onScroll));
 
+        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
         this.actor.connect('enter-event',
                            Lang.bind(this, this._onEnter));
         this.actor.connect('leave-event',
@@ -143,6 +144,11 @@ WindowClone.prototype = {
         this.actor.destroy();
     },
 
+    _onDestroy: function() {
+        if (this._zoomLightbox)
+            this._zoomLightbox.destroy();
+    },
+
     _onEnter: function (actor, event) {
         // If the user drags faster than we can follow, he'll end up
         // leaving the window temporarily and then re-entering it
@@ -228,7 +234,12 @@ WindowClone.prototype = {
         this.emit('zoom-end');
 
         this.actor.reparent(this._origParent);
-        this.actor.raise(this._stackAbove);
+        // If the workspace has been destroyed while we were reparented to
+        // the stage, _stackAbove will be unparented and we can't raise our
+        // actor above it - as we are bound to be destroyed anyway in that
+        // case, we can skip that step
+        if (this._stackAbove && this._stackAbove.get_parent())
+            this.actor.raise(this._stackAbove);
 
         [this.actor.x, this.actor.y]             = this._zoomLocalOrig.getPosition();
         [this.actor.scale_x, this.actor.scale_y] = this._zoomLocalOrig.getScale();
@@ -1324,6 +1335,13 @@ Workspace.prototype = {
 
         this._metaWorkspace.disconnect(this._windowAddedId);
         this._metaWorkspace.disconnect(this._windowRemovedId);
+
+        // Usually, the windows will be destroyed automatically with
+        // their parent (this.actor), but we might have a zoomed window
+        // which has been reparented to the stage - _windows[0] holds
+        // the desktop window, which is never reparented
+        for (let w = 1; w < this._windows.length; w++)
+            this._windows[w].destroy();
     },
 
     // Sets this.leavingOverview flag to false.